package com.itheima.reggie.controller;


import com.itheima.reggie.bean.Dish;
import com.itheima.reggie.common.R;
import com.itheima.reggie.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/dish")
@RestController
public class DishController {
    @Autowired
    private DishService ds;

    //categoryId=1397844303408574500&status=1
    @GetMapping("/list")
    public R list(Long categoryId,Integer status){
        try {
            List<Dish> list = ds.findList(categoryId,status);
            return R.success(list);
        } catch (Exception e) {
            e.printStackTrace();
            return R.error("查询失败！");
        }


    }


}
